/**
 * 
 */
package com.estock.web.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.estock.common.consts.DaoQueryConsts;
import com.estock.common.dao.impl.BaseDaoImpl;
import com.estock.common.model.security.Index;
import com.estock.web.dao.IndexDao;

/**
 * @author richard
 *
 */
@Repository
public class IndexDaoImpl extends BaseDaoImpl<Index> implements IndexDao {

	@SuppressWarnings("rawtypes")
	@Override
	public int getIndexNum() {
        Map<String, Object> queryParams = new HashMap<String, Object>();
		List results = findByNamedQuery(DaoQueryConsts.getIndexNum, queryParams);
		
        if (results == null || results.isEmpty()) return 0;
        return Integer.valueOf(String.valueOf(results.get(0)));
    }
	
}
